<template>
    <el-container>
    <el-row>
        <el-col :span="4"><div class="grid-content"></div></el-col>
        <el-col :span="4">
            <el-main class="bgground">
                <el-row></el-row>
                <el-row>
                    <el-col :span="6"><div class="grid-content"></div></el-col>
                    <el-col :span="6"><div class="grid-content"></div></el-col>
                    <el-col :span="6"><div class="grid-content"></div></el-col>
                    <el-col :span="6">
                        <h1 class="font-color">健康云HIS系统注册</h1>
                        <el-form ref="form" :model="form" :rules="rules" label-width="80px" label-position="left" class="login">
                            <el-form-item label="我是" prop="post">
                                <el-select v-model="form.post" placeholder="请选择岗位" label-position="right" style="width:268px">
                                    <el-option label="挂号收费员" value="1"></el-option>
                                    <el-option label="门诊（临床医生）" value="2"></el-option>
                                    <el-option label="护士" value="3"></el-option>
                                    <el-option label="医技医生" value="4"></el-option>
                                    <el-option label="医院管理员" value="5"></el-option>
                                    <el-option label="超级管理员" value="6"></el-option>
                                </el-select>
                            </el-form-item>
                            <el-form-item label="用户名" prop="name">
                                <el-input v-model="form.name"></el-input>
                            </el-form-item>
                            <el-form-item label="密码" prop="password">
                                <el-input v-model="form.password" show-password></el-input>
                            </el-form-item>
                            <el-form-item>
                                <el-button type="primary" @click="onSubmit()">注册</el-button>
                            </el-form-item>
                        </el-form>
                    </el-col>
                </el-row>
            </el-main>
        </el-col>
        <el-col :span="4"><div class="grid-content"></div></el-col>
        <el-col :span="4"><div class="grid-content"></div></el-col>
        <el-col :span="4"><div class="grid-content"></div></el-col>
        <el-col :span="4"><div class="grid-content"></div></el-col>
    </el-row>
    </el-container>
</template>

<script>
export default {
  name: 'HelloWorld',
  data () {
    return {
        form: {
          name: '',
          post: '',
          password: '',
        },
        rules: {
          name: [
            { required: true, message: '请输入用户名', trigger: 'blur' },
            { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
          ],
          post: [
            { required: true, message: '请选择岗位', trigger: 'change' }
          ],
          password: [
            { type: 'date', required: true, message: '请输入密码', trigger: 'blur' }
          ],
        }
    }
  },
  methods:{
      onSubmit(){
          this.axios({
              method:'post',
              url:'/userRegister',
              data:this.form
          }).then(function (response) {
            console.log(response+"响应成功");
          })
          .catch(function (error) {
            console.log(error+"请求服务器出错");
          });
      }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.bgground{
    background: #fff url("../assets/image/login.png") no-repeat;
    background-size: cover;
    height:600px;
    width:1434px;
}

.bg-purple-dark {
    background: #f8f9fa;
}
.el-row {
    margin-bottom: 100px;
   
}
.el-col {
    border-radius: 4px;
}
.bg-purple {
    background: #d3dce6;
}
.bg-purple-light {
    background: #e5e9f2;
}
.grid-content {
    border-radius: 4px;
    min-height: 36px;
}
.row-bg {
    padding: 10px 0;
    background-color: #f9fafc;
}
.font-color{
    color:#2493be; 
}
</style>
